-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DRAFT] Multi chain adapter #500
base: main
Are you sure you want to change the base?
Conversation
packages/cross-chain-core/src/providers/wormhole/signers/SolanaSigner.ts
Fixed
Show fixed
Hide fixed
packages/cross-chain-core/src/providers/wormhole/signers/SolanaSigner.ts
Fixed
Show fixed
Hide fixed
packages/cross-chain-core/src/providers/wormhole/signers/SolanaSigner.ts
Fixed
Show fixed
Hide fixed
You can simplify the nextjs example by having the button for |
|
||
export type AptosAccount = Account; | ||
|
||
export type Chain = "Solana" | "Ethereum" | "Sui" | "Aptos"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not enum?
export type UsdcBalance = { | ||
amount: string; | ||
decimal: number; | ||
display: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I would implement display
in this component. I think better to let the developer choose how they want to display. I think it just gets complicated because
- Developer might want to only use period to dilineate decimals, while others may want to use comma
- Developer might want to use some kind of significant figures logic
Just think it's not a good idea to put it in this package because it is hard to undo these decisions later
|
||
import { ChainsConfig } from "../types"; | ||
|
||
export const mainnetChains: ChainsConfig = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reference link to where these values come from? Would be nice to leave as comments
Took a good look, great work! The flow I was hoping to see was something similar to this (hopefully you have access): |
packages/cross-chain/cross-chain-core/src/providers/wormhole/signers/SolanaSigner.ts
Fixed
Show fixed
Hide fixed
packages/cross-chain/cross-chain-core/src/providers/wormhole/signers/SolanaSigner.ts
Fixed
Show fixed
Hide fixed
packages/cross-chain/cross-chain-core/src/providers/wormhole/signers/SolanaSigner.ts
Fixed
Show fixed
Hide fixed
That brings up questions around multi chain wallets. For example, Nightly which is a wallet that supports all those chains. |
c135d6b
to
c823561
Compare
9b930b0
to
bdc6d69
Compare
Introducing different packages to handle cross-chain functionalities, that can be used to build and support a cross-chain adapter in any dapp.
Each package can be used as a standalone component, and the dapp should decide what packages it needs following its business logic.
Live example https://aptos-labs.github.io/aptos-wallet-adapter/nextjs-example-testing/swap
wallet-adapter-aggregator:
A folder that contains multiple packages, each represents a
Wallet
. In addition, it holds awallet-adapter-aggregator-core
package that holds the abstract class that each wallet must implement.I implemented a conversion layer for each cross-chain wallet, to represent it as the official Aptos wallet standard. There are some issues I have seen, and I am open for any suggestions.
AccountInfo
from theconnect()
orgetAccount()
methods, is almost impossible because 1) this class represents an Aptos account (and therefore a 32 byte account) and 2) there is no way to retrieve the connected account publicKey from the account address (unless you submitted a transaction)I am open for any implementation suggestions.
cross-chain-core:
A package that holds a cross-chain logic. Currently only provides CCTP transfer logic with Wormhole as the provider. In the Future, we will support more providers (LayerZero, Cellar, etc) and add it to that package.
In addition, this package can expose some related APIs like
getAccountUsdcBalance()
(still debating whether this should live in this package, or be part of thewallet
features).The
CrossChainCore
class accepts different dapp propertiesAnd the
startCCTPTransfer()
method in theWormholeProvider
class acceptscross-chain-react
A React state provider that uses
cross-chain-core
packageNext steps:
signInWithX
getUsdcBalance()
API